﻿using System;

namespace _026_对象初始化器
{
    public class Bunny
    {
        public string Name;
        public bool LikesCarrots;
        public bool LikesHumans;

        public Bunny() { }
        public Bunny(string n) { Name = n; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            //注意无参数构造方法可以省略空括号
            Bunny b1 = new Bunny { Name = "Bo", LikesCarrots = true, LikesHumans = false };
            Bunny b2 = new Bunny("Bo") { LikesCarrots = true, LikesHumans = false };
        }
    }
}
